home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-08-01 | 3.3 KB | 80 lines | [TEXT/ToyS] |
- -----------------------------------------------------------------------
- -- StarNine Technologies, Inc., hereby disclaims all copyright interest
- -- in the following source code.
- --
- -- This source code is free and has been placed into the public domain.
- -- You can redistribute it, modify it (including these comments) and/or
- -- create derivative works from it as you see fit.
- --
- -- This source code is made available in the hope that it will be useful,
- -- but WITHOUT ANY WARRANTY; without even the implied warranty of
- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- -----------------------------------------------------------------------
-
- set oldDelims to AppleScript's text item delimiters
- set AppleScript's text item delimiters to ":"
- set thePath to (text items 1 thru -2 of ((path to me) as string)) as string
- set AppleScript's text item delimiters to oldDelims
- set thePath to alias (thePath & ":ADMIN:Address Lists")
-
- -- here you enter all of your services which will use this script and their file names
- -- the name can be found by choosing "Get Info" in the list editor of ListSTAR
- -- hopefully a future release will eliminate the need for this
-
- if s9MailService is "Listserver Demo" then set theFile to "Listserver Demo List"
- if s9MailService is "My Own Service" then set theFile to "Listserver Demo List.0001"
-
- --set the header of the body
- set theBody to "This is a list of subscribers to the " & s9MailService & " listserver." & return & return
-
- --get the path to the address list
- set thePath to alias ((thePath as string) & theFile)
-
- --open file for reading and read it into the variable listdata
- try
- set listfile to open for access file (thePath as string) --open the file with the digest in it
- set listdata to read listfile from 1 -- read the entire file into theBody
- close access listfile --close the file
- on error errString number errNum
- display dialog errString & " " & errNum
- end try
-
- --first parse by line
- set oldDelims to AppleScript's text item delimiters
- set AppleScript's text item delimiters to return
-
- --eliminate ListSTAR's header line
- set listdata to (text items 2 thru end of listdata)
-
- --repeat with each line in the data file
- repeat with theline in listdata
- set AppleScript's text item delimiters to tab --distinguish free form name from email address
- if (text item 1 of theline is "") then
- try
- set theBody to theBody & text item 4 of theline & return --if no ffn, only show email
- on error
- exit repeat
- end try
- else if (the first text item of theline is equal to text item 4 of theline) then --compare ffn to email
- set theBody to theBody & the first text item of theline & return --if equal, only show once
- else --otherwise add ffn, then tabs, then email
- set theBody to theBody & (the first text item of theline)
- repeat (35 - (count of characters in the first text item in theline)) times
- set theBody to theBody & " "
- end repeat
- set theBody to theBody & (text item 4 of theline) & return
- end if
- set AppleScript's text item delimiters to return
- end repeat
- set AppleScript's text item delimiters to oldDelims
-
- --return address list
- tell application "ListSTAR Server"
- StarNine Log "sending subscriber list" Log Level Debug
- StarNine Send s9MailService ¬
- To {FreeFormName:s9SenderName, EMailAddress:s9SenderEmailAddress} as StarNineAddress ¬
- Subject "Subscribers of the " & s9MailService & ¬
- " list" Body theBody
- end tell
-
- return 0